//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Media;
using OpenLS.Core.Serialization;
using OpenLS.Drawing;

namespace OpenLS.Spreadsheet
{
    class AutomaticColor : SpreadsheetColor
    {
        public AutomaticColor(bool forFill)
        {
            this.forFill = forFill;
        }

        readonly bool forFill = true;
        public override int GetHashCode()
        {
            return Math.PI.GetHashCode() ;
        }

        public override bool Equals(object obj)
        {
            var c = obj as AutomaticColor;
            if (c == null)
                return false;
            return c.forFill == forFill;
        }

        public override Color GetColor(ColorScheme colorScheme)
        {
            {
                if (forFill)
                    return Colors.Transparent;
                return Colors.Black;
            }
        }

        internal override void WriteXmlAs(string name, WriteContext context)
        {
            using (WriteContext c = context.Write(name))
            {
                c.SetBoolean("auto", true);
            }
        }
    }
}
